#coding:utf-8

from twisted.words.xish import domish

from .IqQuery import IqQuery

class Muc(object):
        @staticmethod
        def createPresenceNode(priority,status=None,show=None,):
                presence=domish.Element((None,"presence"))
                presence.addElement("priority",content=str(priority))
                if not status is None:
                        presence.addElement("status",content=status)
                if not show is None:
                        presence.addElement("show",content=show)
                caps = presence.addElement("c","http://jabber.org/protocol/caps")
                return presence
        def callUserProfile(self,user_id):
                iq = IqQuery(self,"get")
                query = iq.addElement("query","askseelove:iq:profile")
                query["user_id"] = user_id
                iq.send(self.selfJid.host)
                return iq
        def pingAndWaitForResponse(self):
                iq = IqQuery(self,"get")
                iq.addElement('ping', 'urn:xmpp:ping')
                return iq